from OneesamaConfig import OneesamaConfig

from misaka.Components.MapReduce import MapReduce
from misaka.Entiy import Oneesama


def Handler(datas):
    for i in datas:
        print(i)


datas = list(range(32523525))

config = OneesamaConfig()

oneesama = Oneesama.Oneesama(Config=config)
my_oneesama = oneesama.sisters_count

map_iter = MapReduce.Map(datas, my_oneesama)  # 使用MapReduce的Map分割任务
print(map_iter)

oneesama.send_2_all()  # 发送全部激活指令

oneesama.creat_server(timeout=30)  # 启动服务器

oneesama.set_datas(map_iter, map_it=False)  # 传入Map分块状变量 或者传入全变量 map_it=True 自动切割
oneesama.set_task(Handler, arg=())

oneesama.give_all_sister()
oneesama.command_line()
